/*
 * @Company: TWL
 * @Author: xue jian
 * @Email: xuejian@kanzhun.com
 * @Date: 2019-12-13 15:07:06
 */
#ifndef JAVA_FUN_H
#define JAVA_FUN_H
#include <string>
int parse_int_fea(std::string& raw_value) {
    int res = (raw_value[3] & 0xFF) | (raw_value[2] & 0xFF) << 8 | (raw_value[1] & 0xFF) << 16 | (raw_value[0] & 0xFF) << 24;
    return res;
};
float parse_float_fea(std::string& raw_value) {
    int iBits;
    iBits = raw_value[0];
    iBits &= 0xff;
    iBits |= ((long) raw_value[1] << 8);
    iBits &= 0xffff;
    iBits |= ((long) raw_value[2] << 16);
    iBits &= 0xffffff;
    iBits |= ((long) raw_value[3] << 24);
    union {
        int i;
        float f;
    } u;
    u.i = (long)iBits;
    return u.f;
};
int64_t parse_long_fea(std::string& raw_value) {
    int64_t res = 0;
    int64_t temp = 0;
    for (int i = 0; i < 8; i++) {
        res <<= 8;
        temp = raw_value[i] & 0xff;
        res |= temp;
    }
    return res;
};



#endif